package com.tax.infrastructure.statemachine;

import com.tax.infrastructure.statemachine.impl.TransitionType;

import java.util.Collection;
import java.util.Optional;

/**
 * State
 * @param <S>
 * @param <E>
 * @param <C>
 */
public interface State<S,E,C> extends Visitable {

    /**
     * get the state identifier
     * @return the state identifier
     */
    S getId();

    /**
     * add transition to the state
     * @param event the event of the transition
     * @param target  the target of the transition
     * @param transitionType
     * @return
     */
    Transition<S,E,C> addTransition(E event, State<S,E,C> target, TransitionType transitionType);

    Optional<Transition<S,E,C>> getTransition(E event);

    Collection<Transition<S,E,C>> getTransitions();
}
